<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sijyp="http://java.sun.com/jsf/composite/sijyp"
	template="#{bienManager.vincularHechoMode ? '/templates/simpleTemplate.xhtml' : '/templates/template.xhtml'}">
	<ui:define name="body">
		<rich:panel style="width:100%">
			<f:facet name="header">
				#{msgExh['exhumaciones.diligencias.cadaver_entrega']}
			</f:facet>

			<h:form id="frm_cadaver_entrega">
				<f:event type="javax.faces.event.PreRenderComponentEvent"
					listener="#{gestionEntregaCadaver.viewHandler}" />

				<a4j:region id="rg_datos_gestion_entrega">
					<h:panelGroup layout="block">
						#{msgExh['exhumaciones.diligencias.cadaver_entrega_general']}
						<hr width="100%" />
						<br />
		
								<h:panelGrid columns="3" columnClasses="col33,col33,col33"
							width="100%">
							<h:panelGrid>
								<h:outputLabel id="lbl_nro_caso"
									value="#{msgExh['exhumaciones.diligencia.num_caso']}:" />
								<h:inputText id="nro_caso"
									value="#{applicationBean.getNumeroCasoAsSpecialString(gestionEntregaCadaver.nroCaso)}" readonly="true"
									disabled="true" />
							</h:panelGrid>
							<h:panelGrid>
								<h:outputLabel id="lbl_nro_fosa"
									value="#{msgExh['exhumaciones.diligencia.registrar.resultado.exhumacion.fosa.numero']}:" />
								<h:inputText id="nro_fosa"
									value="#{gestionEntregaCadaver.nroFosa}" readonly="true"
									disabled="true" />
							</h:panelGrid>
							<h:panelGrid>
								<h:outputLabel id="lbl_nro_acta"
									value="#{msgExh['exhumaciones.cadaver_exhumar.numero_acta']}:" />
								<h:inputText id="nro_acta"
									value="#{gestionEntregaCadaver.nroActa}" readonly="true"
									disabled="true" />
							</h:panelGrid>
						</h:panelGrid>
						<br />
		
						<h:panelGrid width="100%">
							<h:panelGrid>
								<h:outputLabel id="lbl_listo_entrega"
									value="#{msgExh['exhumaciones.diligencias.cadaver_entrega.listo_entrega']}:" />
								<h:selectOneRadio id="listo_entrega" 
									required="true"
									disabled="#{gestionEntregaCadaver.estado == 'VER'}"
									value="#{gestionEntregaCadaver.listoEntregar}"
									valueChangeListener="#{gestionEntregaCadaver.listoEntregarChange}">
									<f:selectItems value="#{gestionEntregaCadaver.sinoValues}" />
									<a4j:ajax event="change" render="frm_cadaver_entrega:pnl_datos_entrega" />
   								</h:selectOneRadio>
								<h:message for="listo_entrega" showSummary="true" showDetail="false"
									styleClass="validationErrorMessage" />
							</h:panelGrid>
						</h:panelGrid>
						<br />
		
						<a4j:outputPanel id="pnl_datos_entrega">
							<h:panelGrid width="100%">
								<h:panelGrid rendered="#{gestionEntregaCadaver.listoEntregar=='N'}">
									<h:outputLabel id="lbl_motivo_noentrega"
										value="#{msgExh['exhumaciones.diligencias.cadaver_entrega.motivo_noentrega']}*:" />
									<h:selectOneMenu id="motivo_noentrega" 									
										required="true"
										value="#{gestionEntregaCadaver.entregaCadaverDto.idTipoMotivoNoEntregaCadaver}"
										requiredMessage="#{msgVal['constraint.not_null']}"
										disabled="#{gestionEntregaCadaver.estado == 'VER'}">
										<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
											noSelectionOption="true" />
										<f:selectItems
											value="#{gestionEntregaCadaver.selectItemsHelper.motivosNoEntrega}" />
									</h:selectOneMenu>
									<h:message for="motivo_noentrega" showSummary="true"
										showDetail="false" styleClass="validationErrorMessage" />
								</h:panelGrid>
							</h:panelGrid>
		
							<h:panelGrid width="100%">
								<h:panelGrid rendered="#{gestionEntregaCadaver.listoEntregar!=null}">
									<h:outputLabel id="lbl_observaciones"
										value="${msgExh['exhumaciones.observaciones']}:" />
									<h:inputTextarea id="observaciones" style="width:100%"
										required="false" styleClass="long count250"
										value="#{gestionEntregaCadaver.entregaCadaverDto.observaciones}"
										disabled="#{gestionEntregaCadaver.estado == 'VER'}" rows="4"
										validatorMessage="#{msgVal['constraint.size.max']} 250">
										<f:validateLength maximum="250" />
									</h:inputTextarea>
									<h:message for="observaciones" showSummary="true"
										showDetail="false" styleClass="validationErrorMessage" />
								</h:panelGrid>
							</h:panelGrid>
							<br />
						</a4j:outputPanel>
					</h:panelGroup>

					<h:panelGroup style="text-align:center;" layout="block">
						<h:commandButton id="btn_guardar" value="#{msgExh['exhumaciones.guardar']}"
							disabled="#{gestionEntregaCadaver.estado == 'VER'}"
							action="#{gestionEntregaCadaver.guardar}">
							<a4j:ajax render="frm_cadaver_entrega frm_cadaver_entrega:historial_entregas_fallidas"
								limitRender="true"
								execute="@region" />
						</h:commandButton>
						<h:commandButton id="btn_cancelar" value="#{msgExh['exhumaciones.cancelar']}"
							action="#{gestionEntregaCadaver.cancelar}" immediate="true">
						</h:commandButton>
					</h:panelGroup>
				</a4j:region>
				<br />

				<h:panelGroup layout="block">
					#{msgExh['exhumaciones.diligencias.cadaver_entrega.hist_entregas_fallidas']}:
					<hr width="100%" />

					<a4j:region id="historial_entregas_fallidas">
						<h:panelGroup layout="block">
							<rich:dataTable id="dt_hist_entregas_fallidas" keepSaved="true" var="record"
								value="#{gestionEntregaCadaver.datosEntrFallidasDm.dataModel}" rows="10">

								<ui:include src="/resources/sijyp/dataModels/columnFecha.xhtml">
									<ui:param name="render_sort" value="dt_hist_entregas_fallidas" />
									<ui:param name="key" value="fecharegistro" />
									<ui:param name="header"
										value="#{msgExh['exhumaciones.fecha']}" />
									<ui:param name="column" value="1" />
									<ui:param name="managedBean"
										value="#{gestionEntregaCadaver.datosEntrFallidasDm}" />
								</ui:include>

								<ui:include src="/resources/sijyp/dataModels/column.xhtml">
									<ui:param name="render_sort" value="dt_hist_entregas_fallidas" />
									<ui:param name="key" value="motivonoentrega" />
									<ui:param name="header"
										value="#{msgExh['exhumaciones.diligencias.cadaver_entrega.motivo_noentrega']}" />
									<ui:param name="column" value="2" />
									<ui:param name="managedBean"
										value="#{gestionEntregaCadaver.datosEntrFallidasDm}" />
								</ui:include>

								<ui:include src="/resources/sijyp/dataModels/column.xhtml">
									<ui:param name="render_sort" value="dt_hist_entregas_fallidas" />
									<ui:param name="key" value="observaciones" />
									<ui:param name="header"
										value="#{msgExh['exhumaciones.observaciones']}" />
									<ui:param name="column" value="3" />
									<ui:param name="managedBean"
										value="#{gestionEntregaCadaver.datosEntrFallidasDm}" />
								</ui:include>

								<f:facet name="footer">
									<rich:dataScroller   maxPages="10"
								fastStep="5"
								fastControls="hide" stepControls="show">
							</rich:dataScroller>
								</f:facet>
							</rich:dataTable>
						</h:panelGroup>
					</a4j:region>
				</h:panelGroup>

			</h:form>
			
			<h:form>
			<h:panelGroup layout="block">
				<h:commandButton id="btn_volver" value="#{msgExh['exhumaciones.volver']}"
					action="#{gestionEntregaCadaver.volver}" inmediate="true">
				    
				</h:commandButton>
				</h:panelGroup>	
			</h:form>
			
		</rich:panel>
	</ui:define>
</ui:composition>